<template>
	<view class="albumTwo">
		<view class="title" @click="jump('store_view', id)">
			<image :src="info.picture" mode="aspectFill" ></image>
			<text>{{info.title}}</text>
		</view>
		<view class="business">营业时间：{{info.business}}</view>
		<view class="content">
			<view class="line" v-for="(item,index) in list" :key="index">
				<view :class="'desk ' + (item.is_use == 1 ? 'no_use' : 'yes_use')" @click="jump(item.is_use == 0? 'lobby' : '', item.id)">
					<view>{{item.title}}</view>
					<!-- <view>可坐人数：{{item.max_num}}</view> -->
					<!-- <view v-if="item.min_money > 0">最低消费：{{item.min_money}}</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import serve from '../static/request.js';
	import storage from '../static/appkey.js';
	import common from '../static/jump.js';
	export default {
		data() {
			return {
				id : 0,
				info: {
					id : 0,
					title : '',
					picture : '',
					business : ''
				},
				list : [],
				imgList: [],
			}
		},
		methods: {
			getList(){
				var self = this;
				serve
					.request({
						url: '/marketing/desk/index',
						data: {
							appkey: uni.getStorageSync('appkey'),
							'access-token': uni.getStorageSync('access-token'),
							merchantId: self.id,
						}
					})
					.then(res => {
						if(res.code != 200) {
							uni.showToast({
								title: res.data.message,
								icon: 'none',
							});
							common.jump('store_view', self.id);
							return ;
						}
						self.info = res.data.info;
						self.list = res.data.list;
					});
			},
			jump(jump_type, jump_link){
				if(jump_type == 'lobby') {
					uni.navigateTo({
					    url: '/pages/merchant/lobby?merchantId='+this.id+'&id='+jump_link
					});
				}
				return ;
			}
		},
		onLoad(options) {
			this.id = options.id || 0;
			if(this.id == 0) {
				uni.showToast({
					title: "错误的访问方式",
					icon: 'none',
				});
				common.jump('return_one')
			}
			this.getList();
		},
		onPullDownRefresh() {
			this.getList();
		},
	}
</script>

<style scoped lang="scss">
	.albumTwo{
		.title{
			display: flex;
			box-sizing: border-box;
			padding: 44upx 30upx 34upx;
			justify-content: center;
			font-size:28upx;
			font-weight:bold;
			color:rgba(57,72,107,1);
			image{
				width:32upx;
				height:32upx;
				margin-right: 12upx;
			}
		}
		.business{
			border-bottom: 2rpx solid #aaa;
			text-align: right;
			padding: 0 50rpx 10rpx;
			border-bottom: 2upx solid #aaa;
		}
		.content{
			box-sizing: border-box;
			padding: 30upx 30upx;
			display: flex;
			flex-wrap: wrap;
			.line{
				padding-top: 10upx;
				display: flex;
				flex-direction: column;
				font-size:24upx;
				width: 44%;
				margin: 10upx 20upx;
				
				.desk{
					width: 100%;
					height: 120upx;
					text-align: center;
					border: 1upx solid #ccc;
					border-radius: 50upx;
					view:first-child{
						margin-top: 27upx;
					}
				}
				
				.no_use{
					background-color: #ccc;
				}
				.yes_use{
					font-weight:bold;
				}
			}
		}
	}
</style>
